package com.heima.admin.controller.v1;

import com.heima.apis.wemedia.IWemediaClient;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.enums.AppHttpCodeEnum;
import com.heima.model.wemedia.pojos.WmSensitive;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
public class WmSensitiveController {

    @Autowired
    private IWemediaClient wemediaClient;

    /**
     * 查询敏感词列表
     * @param sensitiveDto 查询条件
     * @return
     */
    @PostMapping("/list")
    public ResponseResult list(@RequestBody SensitiveDto sensitiveDto){
        return wemediaClient.list(sensitiveDto);
    }


    /**
     * 根据id删除
     * @param id
     * @return
     */
    @DeleteMapping("/del/{id}")
    public ResponseResult delete(@PathVariable Integer id){
        return wemediaClient.delete(id);
    }


    /**
     * 保存
     * @param wmSensitive
     * @return
     */
    @PostMapping("/save")
    public ResponseResult save(@RequestBody WmSensitive wmSensitive){
        return wemediaClient.save(wmSensitive);
    }

    /**
     * 保存
     * @param wmSensitive
     * @return
     */
    @PostMapping("/update")
    public ResponseResult update(@RequestBody WmSensitive wmSensitive){
        return wemediaClient.save(wmSensitive);
    }
}